package com.zhuang.principle.liskov;

/**
 * @Classname Liskov2
 * @Description 用一句话描述类的作用
 * @Date 2021/3/15 14:13
 * @Created by dell
 */

public class Liskov2 {
    public static void main(String[] args) {
        Base base = new Base();
        base.add(5,6);
        base.sub(6,2);

        Sub sub = new Sub();
        sub.mul(5,6);
        sub.div(10,2);
    }
}

class Base {
    //通用加法运算
    public void add(int a, int b) {
        System.out.println(a + "+" + b + "=" + (a + b));
    }

    //通用减法运算
    public void sub(int a, int b) {
        System.out.println(a + "-" + b + "=" + (a - b));
    }
}

class Sub extends Base {
    //子类特有乘法运算
    public void mul(int a, int b) {
        System.out.println(a + "*" + b + "=" + (a * b));
    }

    //子类特有除法运算
    public void div(int a, int b) {
        System.out.println(a + "/" + b + "=" + (a / b));
    }
}

